const logInfo = require('../../../util/logInfo');

module.exports = (cli) => {
  cli.injectFeature({
    name: "Babel",
    value: "babel",
    short: "Babel",
    description:
      "Transpile modern JavaScript to older versions (for compatibility)",
    link: "https://babeljs.io/",
    checked: true,
  });

  cli.onPromptComplete((answers, options) => {
    logInfo('onPromptComplete:根据选择结果,将选择结果最终合并到 options (preset) 中')
    if (answers.features.includes("ts")) {
      if (!answers.useTsWithBabel) {
        return;
      }
    } else if (!answers.features.includes("babel")) {
      return;
    }
    options.plugins["@vue/cli-plugin-babel"] = {};
  });
};
